package com.edu.eduservice.controller;


import com.edu.commonutils.R;
import com.edu.eduservice.service.EduSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author ljw
 * @since 2022-09-15
 */
@Api(description = "课程分类接口")
@RestController
@RequestMapping("/eduservice/edusubject")
//@CrossOrigin
public class EduSubjectController {

    @Autowired(required = false)
    private EduSubjectService eduSubjectService;

    //添加课程分类
    //拿到文件 读取出来把数据 保存到本地

    @PostMapping("/fileupload")
    @ResponseBody
    public R getexcel(MultipartFile file){
        this.eduSubjectService.scannerexcel(file,eduSubjectService);
        return R.ok();
    }

    @ApiOperation("subject一级分类和二级分类")
    @GetMapping("/getsubject")
    @ResponseBody
    //分类
    public R subjects(){
        R  r=this.eduSubjectService.getSubjectService();
        return r;
    }


}

